package platform8085.config;

import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

@Component
public class RewriteResponseBody implements RewriteFunction<String, String> {

    private static final Logger log = LoggerFactory.getLogger(RewriteResponseBody.class);

    @Override
    public Publisher<String> apply(ServerWebExchange serverWebExchange, String responseBody) {
        log.info("ResponseBody:{}", responseBody);
        return Mono.justOrEmpty(responseBody);
    }
}
